import redis
r = redis.Redis(host='192.168.209.200', port=6379, db=0)
#循环添加100条记录
for i in range(0,100):
    r.set("key"+str(i),i)

#进行一次scan
cursor = 0
cursor,keys = r.scan(cursor=cursor,match="*")
for k in keys:
    print(k)
#循环迭代扫描，直到结尾
while cursor !=0:
    cursor,keys = r.scan(cursor=cursor,match="*",count=10)
    for k in keys:
        print(k)

r.close()